package com.labot.service.impl;

import com.labot.dao.AreaDao;
import com.labot.model.Area;
import com.labot.service.AreaManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * Implementation of RoleManager interface.
 *
 * @author <a href="mailto:dan@getrolling.com">Dan Kibler</a>
 */
@Service("areaManager")
public class AreaManagerImpl extends GenericManagerImpl<Area, Long> implements AreaManager {
    AreaDao areaDao;

    @Autowired
    public AreaManagerImpl(AreaDao areaDao) {
        super(areaDao);
        this.areaDao = areaDao;
    }

	@Override
	public void setAreaDao(AreaDao areaDao) {
		 this.areaDao = areaDao;
		
	}

	@Override
	public Area getAreaByNombre(String nombre) throws Exception {
		return areaDao.buscarAreaPorNombre(nombre);
	}

	@Override
	public Set<Area> getAreas() {
		return areaDao.getAreas();
	}

	@Override
	public Area saveArea(Area area) {
		return areaDao.saveArea(area);
	}

	@Override
	public void removeArea(Area area) {
		areaDao.remove(area);
		
	}

	@Override
	public void removeArea(String areaId) {
		areaDao.remove(Long.parseLong(areaId));
		
	}

	@Override
	public Area buscarArea(Long id) {
		return areaDao.buscarArea(id);
	}
}